package com.iflytek.esb.domain;

import java.io.Serializable;
import java.util.Iterator;

import net.sf.json.JSONObject;

public class PersistenceMessage extends Message implements Serializable  {
	
	private static final long serialVersionUID = 6959324943412126744L;
	private long id;
	private long entryId;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getEntryId() {
		return entryId;
	}

	public void setEntryId(long entryId) {
		this.entryId = entryId;
	}


	public String getHeaders__() {
		JSONObject json = JSONObject.fromObject(getHeaders());
		return json.toString();
	}
	
	@SuppressWarnings("unchecked")
	public void setHeaders__(String headers__) {
		JSONObject json = JSONObject.fromObject(headers__);
		Iterator<String> iter = json.keys();
		while (iter.hasNext()) {
			String key = iter.next();
			String value = json.getString(key);
			getHeaders().put(key, value);
		}
	}

	public String getResponseHeaders__() {
		JSONObject json = JSONObject.fromObject(getResponseHeaders());
		return json.toString();
	}
	
	@SuppressWarnings("unchecked")
	public void setResponseHeaders__(String responseHeaders__) {
		JSONObject json = JSONObject.fromObject(responseHeaders__);
		Iterator<String> iter = json.keys();
		while (iter.hasNext()) {
			String key = iter.next();
			String value = json.getString(key);
			getResponseHeaders().put(key, value);
		}
	}
}
